** Replication Code for:
** Terrorism Activates Ethnocentrism to Explain Greater Willingness to 
** Sacrifice Civil Liberties: Evidence from Germany
** Authors: Christina Novak Hansen and Peter Thisted Dinesen 
** Date: 10/02/2021

*-------------------------------------------------------------------------------


*-------------------------------------------------------------------------------
*Appendix B: Time frame and studied sample
*-------------------------------------------------------------------------------

clear all
use GGSS2016_analysis.dta
svyset xs11 [pweight=wghtpew], vce(linearized)


********************************************************************************


							  ***B1 Time frame***

								***Figure B1***
								
*Timing of high-profile terrorist attacks during the fieldwork period 
gen reflines=0
replace reflines = 100 if edate==td(09/01/2015) /*Paris january*/
replace reflines = 100 if edate==td(13/11/2015) /*Paris November*/
replace reflines = 100 if edate==td(31/12/2015)	/*New Year's*/
replace reflines = 100 if edate==td(22/03/2016) /*Brussels*/
replace reflines = 100 if edate==td(12/06/2016) /*Orlando*/
replace reflines = 100 if edate==td(14/07/2016) /*Nice*/
replace reflines = 100 if edate==td(18/07/2016) /*Würzburg*/
replace reflines = 100 if edate==td(22/07/2016) /*Munich*/
replace reflines = 100 if edate==td(24/07/2016) /*Ansbach*/
replace reflines = 100 if edate==td(26/07/2016) /*Normandy*/
replace reflines = 100 if edate==td(19/12/2016) /*Berlin*/

	
twoway (bar Interviews edate if edate>=td(15/03/2016) & edate<=td(18/09/2016), fcolor(white) lcolor(gs13)) ///
	(bar Interviews edate if edate>=td(24/06/2016) & edate<=td(13/07/2016), fcolor(gs14) lcolor(gs9)) ///
	(bar Interviews edate if edate>=td(27/07/2016) & edate<=td(02/08/2016), fcolor(gs8) lcolor(gs5)) ///
	(spike reflines edate if edate>=td(20/03/2016) & edate<=td(28/09/2016), lcolor(black)), ///
	ytitle(Interviews per day (n)) ytitle(, size(msmall) margin(small)) ///
	ylabel(#6, labsize(msmall) angle(horizontal) labgap(tiny) grid) xtitle("") ///
	xlabel(#7, labsize(msmall) angle(stdarrow)) ///
	legend(order(2 "Pre-attacks group: 24 June to 13 July, n=238" 3 "Post-attacks group: 27 July to 2 August, n=59" 4 "High-profile terror attacks") cols(1) ///
	rowgap(small) size(msmall) region(lcolor(none)))

graph export Figure_B1.pdf, replace

drop reflines
********************************************************************************


							***B2 Studied sample***
							
keep if governmentsplit==1 & treatment1!=. & german==1

*All respondends in studied subsample 
tab treatment1
tab sex if treatment1!=.
sum age

tab treatment1 if st_terrori!=. & st_ethno!=. & sex!=. & age!=. & proedu2!=. & work2!=.


